

graph drop _all
use Data/sample_income_discountoc_angle.dta, clear

	keep if hour >=7 & hour<=18
	
	
	egen cut_export = cut(exportkWh), at(0(0.5)6)
	
	
	

	
	
	collapse (mean) FIT_price (sd) sdFIT_price = FIT_price, by(cut_export)

	
	label variable FIT_price "Sell price (c/kWh)"
	label variable cut_export "Sales (kWh)"
	
	
	gen upper_FIT = FIT_price + sdFIT_price
	gen lower_FIT = FIT_price - sdFIT_price
	
	
	twoway (connected FIT_price cut_export, msymbol(none) lcolor(gs0) lwidth(thick)), ytitle("Sell price (c/kWh)", size(medlarge)) ///
	yscale(range(0 40)) ylabel(#4) xtitle("Sales (kWh)", size(medlarge)) legend(off) scheme(s2mono) graphregion(color(white)) ///
		 title(Panel A. Sales in kWh , position(11) size(huge) ring(7)) name(sales)

	
		graph export Results/Andrea/rawsupply.pdf, replace

		
	
	twoway (rarea upper_FIT lower_FIT cut_export, color(gs14)) (connected FIT_price cut_export, msymbol(none) lcolor(gs0) lwidth(thick)), ytitle("Sell price (c/kWh)", size(medlarge)) ///
	yscale(range(0 40)) ylabel(#4) xtitle("Sales (kWh)", size(medlarge)) legend(off) scheme(s2mono) graphregion(color(white)) ///
		 title(Panel A. Sales in kWh , position(11) size(huge) ring(7)) name(sales2)

		
		
		
		
		
		
		
		


use Data/Andrea/sample_income_discountoc.dta, clear

	keep if hour >=7 & hour<=18
	
	gen salesperkWh = export/PV_prod
	
	drop if sales >1

	egen cut_salesperkWh = cut(salesperkWh), at(0(0.1)1)
	
	
	
	collapse (mean) FIT_price (sd) sdFIT_price = FIT_price, by(cut_sales)

	
	label variable FIT_price "Sell price (c/kWh)"
	label variable cut "Sales/kWh"
	
	
	gen upper_FIT = FIT_price + sdFIT_price
	gen lower_FIT = FIT_price - sdFIT_price

	
	twoway (connected FIT_price cut_salesperkWh, msymbol(none) lcolor(gs0) lwidth(thick)), ytitle("Sell price (c/kWh)", size(medlarge)) ///
	yscale(range(0 40)) ylabel(#4) xtitle("Sales/kWh production", size(medlarge)) legend(off) scheme(s2mono) graphregion(color(white)) ///
				 title(Panel B. Sales per kWh of production, position(11) size(huge) ring(7)) name(salesperkwh)

		
	graph export Results/Andrea/rawsupplyperkwh.pdf, replace

	
		
	
	twoway (rarea upper_FIT lower_FIT cut_sales, color(gs14)) (connected FIT_price cut_salesperkWh, msymbol(none) lcolor(gs0) lwidth(thick)), ytitle("Sell price (c/kWh)", size(medlarge)) ///
	yscale(range(0 40)) ylabel(#4) xtitle("Sales/kWh production", size(medlarge)) legend(off) scheme(s2mono) graphregion(color(white)) ///
	  title(Panel B. Sales per kWh of production, position(11) size(huge) ring(7)) name(salesperkwh2)


	
		
		
		
	graph combine sales salesperkwh, cols(2) xsize(2.5) ysize(1)
	
	graph export Results/Andrea/sales_production.pdf, replace
	
		
		
		
		
	graph combine sales2 salesperkwh2, cols(2) xsize(2.5) ysize(1)
	
	graph export Results/Andrea/sales_production_sds.pdf, replace
	
		
		
		
